<template>
<div>
    <div class="h-27">
					<div class="p-1">
						<div class="p-2">添加挂牌</div>
						<div class="p-3">
							<!--路由-->
							<div class="b-8">
								<div class="b-9 p-4">当前位置： <a href="javascript:;">首页</a> > <a href="javascript:;">添加挂牌</a></div>
							</div>


						</div>
						<div class="p1-5">
							<div class="p-5">
									<div class="p-6">
                                          <el-upload
  class="p-7"
  :action="uploadUrls"
  :show-file-list="false"
  :on-success="UploadImgSuccess"
  >
  <img v-if="cover_image" :src="cover_image" class="avatar">
  <i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
										<!-- <img class="p-7" src="images/fm.png" /> -->
										<div class="p-8">
											<div class="p-9">项目挂牌作品封面图</div>
                                            <div class="price-1" style="margin-top: 40px;position: relative;"><span class="price-2" style="text-align-last: justify;width: 60px;display: inline-block">价格</span>：<input v-model="price" class="price-3" type="text" style="width: 150px;border: 1px solid #ececec;padding: 0 10px;box-sizing: border-box;padding-right: 50px;" placeholder="请输入价格"/><span style="position: absolute;right: 20px">(元)</span></div>
                            <div class="time-1" style="margin-top: 10px;position: relative;"><span class="time-3" style="color: #d81e06;position: absolute;left: -5px">*</span><span class="time-2" style="text-align-last: justify;width:60px;display: inline-block">挂牌天数</span>：<input v-model="term" class="time-4" style="width: 150px;border: 1px solid #ececec;padding: 0 10px;box-sizing: border-box" type="text" placeholder="请输入天数"/></div>
										</div>
									</div>
									<div class="p-10">
                                         <div class="p-11">
											<span class="p-12">*<label>选择挂牌类型：</label></span>
											<div class="p-13">
                                                <el-radio v-model="trading_type" :label="1" @change="changeTradingType">项目挂牌</el-radio>
                                                <el-radio v-model="trading_type" :label="0" @change="changeTradingType">作品挂牌</el-radio>

                                                <!-- <label><input  type="radio" v-model="trading_type" value="1" @click="changTradType">项目挂牌 </label>
												<label><input  type="radio" v-model="trading_type" value="0" @click="changTradType">作品挂牌 </label> -->
											</div>
										</div>
                                         <div class="p-11" v-if="trading_type==1">
											<span class="p-12">*<label>选择项目类型：</label></span>
											<div class="p-13">
                                                <el-radio v-model="term_type" :label="0">转让</el-radio>
                                                <el-radio v-model="term_type" :label="1">许可</el-radio>


											</div>
										</div>
										<div class="p-11">
											<span class="p-12">*<label>选择身份：</label></span>
											<div class="p-13">
                                                <el-radio v-model="prove_type" :label="1">企业</el-radio>
                                                <el-radio v-model="prove_type" :label="0">个人</el-radio>
												<!-- <label><input  v-model="prove_type" type="radio" value="1">企业 </label>
												<label><input  v-model="prove_type" type="radio" value="0">个人 </label> -->
											</div>
										</div>

										<div class="p-14">
											<div class="p-15">提示：挂牌信息登记表二选一</div>
											<div class="p-16">
												<div class="p-17" v-if="term_type==0 "><span class="p-12">*<label>标的信息登记表（转让）</label></span><a href="javascript:;" class="p-18 zr"  @click="dialogVisible = true" >点击登记</a></div>
												<div class="p-17" v-if="term_type==1 "><span class="p-12">*<label>标的信息登记表（许可使用）</label></span><a href="javascript:;" class="p-18 xk" @click="dialogVisible = true">点击登记</a></div>
											    <div class="p-17" v-if="trading_type==0"><span class="p-12">*<label>作品信息表</label></span><a href="javascript:;" class="p-18 xk" @click="dialogVisibles = true">点击登记</a></div>
                                            </div>
										</div>
										<div class="p-19" style="margin-top: 10px;">
											<div class="p-20">
												<div class="p-17"><span class="p-12">*<label>挂牌协议书</label></span><a href="javascript:;" class="p-18 xy" @click="dialognima = true">点击查看</a></div>
											</div>
										</div>
										<div class="p-19 p1-19">
											<div class="p-20">
												<div class="p-17"><span class="p-12">*<label>对摘牌准入要求与条件 </label></span><a href="javascript:;" class="p-18 sr" @click="showContent">点击输入</a></div>
												<div class="p1-58" v-show="show">
													<textarea class="p-59" v-model="delist_text"></textarea>
													<ul class="p-25">

                                                <el-upload
                                                    :action="uploadUrls"

                                                    :multiple = true
                                                    list-type="picture-card"
                                                    :limit='3'
                                                    :with-credentials='true'
                                                    :on-preview="handlePictureCardPreview"
                                                    :on-remove="handleRemove"
                                                    :on-error="handleError"
                                                    :on-success="handledelistImage"
                                                    :before-upload="beforeAvatarUpload">
                                                <i class="el-icon-plus"></i>
                                            </el-upload>
                                            <el-dialog :visible.sync="dialogImg">
                                                <img width="100%" :src="image" alt="">
                                            </el-dialog>


													</ul>
												</div>
											</div>
										</div>
									</div>
						</div>
						<div class="p-21">
							<div class="p-22"><span class="p-12">*<label>挂牌作品样片：</label></span><a href="javascript:;" class="p-18">挂牌作品样片,限定10张</a></div>
							<ul class="p-23">
                                            <el-upload
                                                    :action="uploadUrls"
                                                    :multiple = true
                                                    list-type="picture-card"
                                                    :limit='10'
                                                    :with-credentials='true'
                                                    :on-preview="handlePictureCardPreview"
                                                    :on-remove="handleRemove"
                                                    :on-error="handleError"
                                                    :on-success="handlebasicImage"
                                                    :before-upload="beforeAvatarUpload">
                                                <i class="el-icon-plus"></i>
                                             </el-upload>
                                            <el-dialog :visible.sync="dialogImg">
                                                <img width="100%" :src="image" alt="">
                                            </el-dialog>

							</ul>
						</div>
						<div class="p-24">
							<div class="p-22"><span class="p-12">*<label>证明文件：</label></span><a href="javascript:;" class="p-18">企业：营业执照复印件、法人身份证复印件</a></div>
							<ul class="p-25">
                                 <el-upload
                                                    :action="uploadUrls"

                                                    :multiple = true
                                                    list-type="picture-card"
                                                    :limit='10'
                                                    :with-credentials='true'
                                                    :on-preview="handlePictureCardPreview"
                                                    :on-remove="handleRemove"
                                                    :on-error="handleError"
                                                    :on-success="handleproveImage"
                                                    :before-upload="beforeAvatarUpload">
                                                <i class="el-icon-plus"></i>
                                            </el-upload>
                                            <el-dialog :visible.sync="dialogImg">
                                                <img width="100%" :src="image" alt="">
                                            </el-dialog>

							</ul>
						</div>
						<div class="p-21">
							<div class="p-22"><span class="p-12">*<label>著作权登记证书：</label></span><a href="javascript:;" class="p-18">挂牌作品的确权证明</a></div>
							<ul class="p-23">
                                <el-upload
                                                    :action="uploadUrls"

                                                    :multiple = true
                                                    list-type="picture-card"
                                                    :limit='10'
                                                    :with-credentials='true'
                                                    :on-preview="handlePictureCardPreview"
                                                    :on-remove="handleRemove"
                                                    :on-error="handleError"
                                                    :on-success="handleauthorCertificate"
                                                    :before-upload="beforeAvatarUpload">
                                                <i class="el-icon-plus"></i>
                                            </el-upload>
                                            <el-dialog :visible.sync="dialogImg">
                                                <img width="100%" :src="image" alt="">
                                            </el-dialog>

							</ul>
						</div>
						<div class="p-28"><button class="p-29" @click="submitTrading(0)">存草稿</button><button style="margin-left:10px" class="p-29" @click="submitTrading(1)">提交</button></div>
						</div>
					</div>
				</div>
				<div style="clear: both;"></div>



<!-- 这是做标的信息登记表（转让） -->
<el-dialog

  :visible.sync="dialogVisible"
  width="980px"

  center>
  <template slot="title">
      <div v-if="term_type==1">标的信息登记表（许可使用）</div>
      <div v-if="term_type==0">标的信息登记表（转让）</div>
  </template>
  <div class="p-34">
					<div class="p-36">
						<table class="p-35">
							<tr>
								<td rowspan="10" class="p-37" style="height: 570px;">作品信息</td>
								<td class="p-38">作品名称</td>
								<td colspan="6"><input type="text" v-model="project_table_form.project_name" style="width: 100%;height: 100%;padding: 0 10px;box-sizing: border-box;"></td>
							</tr>
							<tr>
								<td class="p-38" style="height: 125px;">作品类别</td>
								<td colspan="6" style="text-align: left;padding: 0 10px;text-align: left;">
                                     <el-radio-group v-model="project_table_form.project_type" class="ptype">
                                      <el-radio  :label="item.dictCode" v-for="item in projectType" :key="item.dictCode">{{item.dictLabel}}</el-radio>
                                      </el-radio-group>




								</td>
							</tr>
							<tr>
								<td rowspan="4" class="p-38">著作权人</td>
								<td style="width: 80px;">姓名或名称</td>
								<td style="width: 80px;">证件类型</td>
								<td style="width: 200px;">证件号码</td>
								<td style="width: 80px;">国籍</td>
								<td style="width: 80px;">省份</td>
								<td style="width: 80px;">城市</td>
							</tr>
							<tr v-for="n in 3" :key="n">
								<td style="height: 27px;"><input type="text" v-model="author_list[n-1].author_name" style="width: 100%;height: 100%;text-align: center;"></td>
								<td style="height: 27px;">
                                     <el-select v-model="author_list[n-1].certificate_type" placeholder="请选择">
                                        <el-option
                                          v-for="item in certificateType"
                                          :key="item.dictCode"
                                          :label="item.dictLabel"
                                          :value="item.dictCode">
                                        </el-option>
                                     </el-select>

								</td>
								<td style="height: 27px;"><input type="text" v-model="author_list[n-1].certificate_number" style="width: 100%;height: 100%;text-align: center;"></td>
								<td style="height: 27px;"><input type="text" v-model="author_list[n-1].country" style="width: 100%;height: 100%;text-align: center;"></td>
								<td style="height: 27px;"><input type="text" v-model="author_list[n-1].province" style="width: 100%;height: 100%;text-align: center;"></td>
								<td style="height: 27px;"><input type="text" v-model="author_list[n-1].city" style="width: 100%;height: 100%;text-align: center;"></td>
							</tr>

							<tr>
								<td class="p-38">作品创作性质</td>
								<td colspan="6" style="text-align: left;padding: 0 10px;">

                                 <el-radio-group v-model="project_table_form.creation_type" class="ptype ctype">
                                      <el-radio  :label="item.dictCode" v-for="item in creationType" :key="item.dictCode">{{item.dictLabel}}</el-radio>

                                      </el-radio-group>



								</td>
							</tr>
							<tr>
								<td class="p-38" style="height: 35px;">创作完成日期</td>
								<td colspan="2" style="height: 35px;">

                                     <el-date-picker value-format="yyyy-MM-dd HH:mm:ss" v-model="project_table_form.creation_finish_time" type="date" placeholder="选择日期"></el-date-picker>
                                    </td>
								<td colspan="2" style="height: 35px;">创作完成地点</td>
								<td colspan="2" style="height: 35px;"><input type="text" v-model="project_table_form.creation_finish_site" style="width: 100%;height: 100%;text-align: center;" ></td>
							</tr>
							<tr>
								<td class="p-38">发表状态</td>
								<td colspan="6" style="text-align: left;padding: 0 10px;">
									<div class="p-41">
                                         <el-radio  v-model="project_table_form.published_state" :label="0">未发表</el-radio>
                                         <el-radio v-model="project_table_form.published_state" :label="1">已发表</el-radio>

									</div>
									<div class="p-41">
										<div class="p-42">
											<span class="p-43">首次发表日期：</span>

                                                      <el-date-picker value-format="yyyy-MM-dd HH:mm:ss" v-model="project_table_form.published_first_time" type="date" placeholder="选择日期"></el-date-picker>

										</div>
										<div class="p-45">
											<span class="p-46">发表地点：</span>
											<div class="p-47"><span class="p-48">国家：</span><input class="p-49" type="text" v-model="project_table_form.published_country"></div>
											<div class="p-47"><span class="p-48">城市：</span><input class="p-49" type="text" v-model="project_table_form.published_city"></div>
										</div>
									</div>
								</td>
							</tr>
							<tr>
								<td class="p-38">作品简介</td>
								<td colspan="6" style="text-align: left;">
									<textarea class="p-50" style="height:60px" placeholder="请输入作品简介" v-model="project_table_form.project_explain"></textarea>
								</td>
							</tr>
							<tr>
								<td rowspan="2" v-if="term_type==0" class="p-37" style="height: 445px;">作品信息</td>
                                <td rowspan="5" v-if="term_type==1" class="p-37" style="height: 445px;">作品信息</td>
								<td class="p-38" style="height: 250px;">著作权人权利拥有状况</td>
								<td colspan="6" style="text-align: left;padding: 0 10px;">

                                <el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange">全选</el-checkbox>
                               <div style="margin: 15px 0;"></div>
                             <el-checkbox-group v-model="project_table_form.possess_power" @change="handleCheckedCitiesChange">
                              <el-checkbox v-for="v in powerType" :label="v.dictCode" :key="v.dictCode">{{v.dictLabel}}</el-checkbox>
                              </el-checkbox-group>




								</td>
							</tr>
							<tr>
								<td class="p-38" style="height: 195px;">挂牌标的</td>
								<td colspan="6" style="text-align: left;padding: 0 10px;">

                                    <el-checkbox :indeterminate="isIndeterminates" v-model="checkAlls" @change="handleCheckAllChanges">全选</el-checkbox>
                               <div style="margin: 15px 0;"></div>
                             <el-checkbox-group v-model="project_table_form.trading_power" @change="handleCheckedCitiesChanges">
                              <el-checkbox v-for="v in powerType" :label="v.dictCode" :key="v.dictCode">{{v.dictLabel}}</el-checkbox>
                              </el-checkbox-group>


								</td>
							</tr>
                              <tr  v-if="term_type==1">
                                    <td style="height: 35px;">许可方式</td>
                                    <td colspan="6" style="height: 35px; text-align: left;padding: 0 10px;">
                                        <div class="p-41">
                                            <el-radio  v-model="project_table_form.permission_type" :label="0">专有</el-radio>
                                         <el-radio v-model="project_table_form.permission_type" :label="1">一般</el-radio>

                                            <!-- <label class="p-39"><input name="zy"   id="1j_cbAll2" type="radio" value="0" >专有</label>
                                            <label class="p-39"><input name="zy" id='1j_cbPart2' type="radio" value="1" >一般</label> -->
                                        </div>
                                    </td>
                                </tr>
                                <tr v-if="term_type==1">
                                    <td style="height: 35px;">许可期限</td>
                                    <td colspan="6" style="height: 35px;text-align:left">

 <el-date-picker
      v-model="startendTime"
      type="daterange"
      range-separator="至"
      start-placeholder="开始日期"
      end-placeholder="结束日期"
      value-format="yyyy-MM-dd HH:mm:ss"
      >
    </el-date-picker>
</td>
                                </tr>
                                <tr v-if="term_type==1">
                                    <td style="height: 35px;">许可区域</td>
                                    <td colspan="6" style="height: 35px;padding: 0 10px;">
                                        <input  type="text" style="width: 100%;height: 100%;" v-model="project_table_form.permission_region"/>
                                    </td>
                                </tr>

						</table>
					</div>

				</div>
  <span slot="footer" class="dialog-footer">
    <el-button @click="dialogVisible = false">取 消</el-button>
    <el-button type="danger" @click="checkProjectForm" >确 定</el-button>
  </span>
</el-dialog>


<el-dialog
  title="作品信息登记表"
  :visible.sync="dialogVisibles"
  width="980px"
  center>


<div class="p-34">
					<div class="p-36">
						<table class="p-35">
							<tr>
								<td rowspan="11" class="p-37" style="height: 570px;">作品信息</td>
								<td class="p-38">作品名称</td>
								<td colspan="6"><input type="text" v-model="works_table_form.works_name" style="width: 100%;height: 100%;padding: 0 10px;box-sizing: border-box;"></td>
							</tr>
							<tr>
								<td class="p-38" style="height: 125px;" rowspan="3">作品信息</td>
								<td class="p-38">类别</td>
								<td colspan="5" style="text-align: left;padding: 0 10px;text-align: left;">
									 <el-radio-group v-model="works_table_form.works_type" class="ptype">
                                      <el-radio  :label="item.dictCode" v-for="item in projectType" :key="item.dictCode">{{item.dictLabel}}</el-radio>

                                      </el-radio-group>
								</td>
							</tr>
							<tr>
								<td style="height: 27px;">题材</td>
								<td style="height: 27px;text-align:left;" colspan="5">
                                    <el-radio-group v-model="works_table_form.works_theme" class="ptype ctype">
                                      <el-radio  :label="item.dictCode" v-for="item in worksTheme" :key="item.dictCode">{{item.dictLabel}}</el-radio>

                                      </el-radio-group>
                                    <!-- <input type="text" v-model="works_table_form.works_theme" style="width: 100%;height: 100%;padding: 0 10px;box-sizing: border-box;"> -->
                                    </td>
							</tr>
							<tr>
								<td style="height: 27px;">地区</td>
								<td style="height: 27px;text-align:left;" colspan="5">

                                  <el-select v-model="works_table_form.works_region" placeholder="请选择">
    <el-option
      v-for="item in worksRegion"
      :key="item.dictCode"
      :label="item.dictLabel"
      :value="item.dictCode">
    </el-option>
  </el-select>
<!--
                                    <el-radio-group v-model="works_table_form.works_region" class="ptype ctype">
                                      <el-radio  :label="item.dictCode" v-for="item in worksRegion" :key="item.dictCode">{{item.dictLabel}}</el-radio>

                                      </el-radio-group> -->
                                    <!-- <input type="text" v-model="works_table_form.works_region" style="width: 100%;height: 100%;padding: 0 10px;box-sizing: border-box;"> -->
                                    </td>
							</tr>
							<tr>
								<td class="p-38">著作权人姓名或名称</td>
								<td colspan="6"><input type="text" v-model="works_table_form.author" style="width: 100%;height: 100%;padding: 0 10px;box-sizing: border-box;"></td>
							</tr>

							<tr>
								<td class="p-38" rowspan="2">作品创作性质</td>
								<td colspan="6" style="text-align: left;padding: 0 10px;">
                                      <el-radio-group v-model="works_table_form.creation_type" class="ptype ctype">
                                      <el-radio  :label="item.dictCode" v-for="item in creationType" :key="item.dictCode">{{item.dictLabel}}</el-radio>

                                      </el-radio-group>

								</td>
							</tr><tr>
								<td class="p-38" style="height: 27px;">备注</td>
								<td colspan="6" style="height: 27px;"><textarea type="text" v-model="works_table_form.creation_remark" style="width: 100%;height: 80px;padding: 5px 10px;box-sizing: border-box;"></textarea></td>
							</tr>
							<tr>
								<td class="p-38" style="height: 35px;">创作完成日期</td>
								<td colspan="6" style="height: 35px;">
                                    <el-date-picker value-format="yyyy-MM-dd HH:mm:ss" v-model="works_table_form.end_time" type="date" placeholder="选择日期"></el-date-picker>

                                    </td>
							</tr>
							<tr>
								<td class="p-38" style="height: 35px;">发行地区</td>
								<td colspan="6" style="height: 35px;"><input type="text" v-model="works_table_form.issue_region" style="width: 100%;height: 100%;padding: 0 10px;box-sizing: border-box;"></td>
							</tr>
							<tr>
								<td class="p-38" style="height: 35px;">主要创作人员</td>
								<td colspan="6" style="height: 35px;"><input type="text" v-model="works_table_form.authors" style="width: 100%;height: 100%;padding: 0 10px;box-sizing: border-box;"></td>
							</tr>
							<tr>
								<td class="p-38" style="height: 35px;">作品权益类型</td>
								<td colspan="6" style="height: 35px;text-align: left;padding: 0 10px;">
                                    <el-checkbox :indeterminate="isIndeterminatess" v-model="checkAllss" @change="tradingPowerCheckAllChange">全选</el-checkbox>
                               <div style="margin: 15px 0;"></div>
                             <el-checkbox-group v-model="works_table_form.trading_power" @change="tradingPowerCheckedChange">
                              <el-checkbox v-for="v in powerType" :label="v.dictCode" :key="v.dictCode">{{v.dictLabel}}</el-checkbox>
                              </el-checkbox-group>

								</td>
							</tr>

							<tr>
								<td class="p-37" style="height: 250px;">作品简介</td>
								<td colspan="6" style="text-align: left;height: 250px;">
									<textarea class="p-50" placeholder="请输入作品简介" v-model="works_table_form.works_explain"></textarea>
								</td>
							</tr>

						</table>
					</div>

				</div>










  <span slot="footer" class="dialog-footer">
    <el-button @click="dialogVisibles = false">取 消</el-button>
    <el-button type="danger" @click="checkWokerForm">确 定</el-button>
  </span>
</el-dialog>


<el-dialog
  title="挂牌协议书"
  :visible.sync="dialognima"
  
  >
  
						<div class="p-58" style="line-height: 35px;max-height:300px;overflow:auto;">
							××建筑工程公司（甲方）<br />
							××装修设计公司（乙方）<br />
							为发挥双方的优势，共谋发展，并为今后逐步向组成集团公司过渡，双方经过充分友好的协商，特订立本协议。<br />
							一、建立密切的技术合作关系，今后凡甲方承接的工程，装修设计任务均交给乙方承担。<br />
							二、乙方保证，在接到任务后，将立即组织以高级工程师为领导的精干设计队伍，在10日提出设计方案，并在方案认可后一个月内完成全部设计图纸。<br />
							三、为保证设计的质量，甲方将毫无保留地向乙方提供所需的一切建筑技术资料。<br />
							四、装修施工队伍由甲方组织，装修工程的施工由甲方组织实施。施工期间，乙方派出高级工程师监督施工，以保证工程的质量。<br />
							五、甲方按装修工程总费用的千分之×向乙方支付设计费。<br />
							六、本协议自签订之日起生效。<br />
							七、本协议书一式两份，双方各执一份。<br />
							附件：《××建筑装修工程集团公司组建意向书》一份。<br />
							甲方 ××建筑工程公司（盖章）<br />
							法人代表：××（签字）<br />
							乙方 ××装修设计公司（盖章）<br />
							法人代表：××（签字）<br />
							19××年×月×日<br />
							甲方地址：×××××× 乙方地址：××××××<br />
							邮政编码：×××××× 邮政编码：××××××<br />
							电话兼传真：×××××× 电话兼传真：××××××<br />
							银行账号：×××× 银行账号：××××<br />
							联系人：×××联系人：×××<br />
						</div>
				
  <span slot="footer" class="dialog-footer">
    <el-button @click="dialognima = false">取 消</el-button>
    <el-button type="primary" @click="dialognima = false">确 定</el-button>
  </span>
</el-dialog>


			</div>
</template>
<script>
var _self;
const baseUrl = process.env.VUE_APP_BASE_API;
import {addTrading} from '@/api/addTrading';
export default {
    data(){
        return{
            dialogVisible:false,
            dialogVisibles:false,
            dialognima:false,
            dialogImg:false, 
            image:undefined, //图片预览 52259231
            show:false,
            projectType:[],//作品类型
            creationType:[],//作品性质
            powerType:[],//权利类型
            certificateType:[],//证件类型
            worksTheme:[],//题材类型
            worksRegion:[],//地区
            author_list:[
                {author_name:undefined,certificate_type:undefined,certificate_number:undefined,country:undefined,province:undefined,city:undefined},
                {author_name:undefined,certificate_type:undefined,certificate_number:undefined,country:undefined,province:undefined,city:undefined},
                {author_name:undefined,certificate_type:undefined,certificate_number:undefined,country:undefined,province:undefined,city:undefined}
            ],//著作权人重新绑定

            project_table_form:{   //标的信息登记表（转让）
                project_type:undefined,
                project_name:undefined,
                project_author_list:[],//著作权人
                creation_type:undefined,//作品性质
                creation_finish_time:undefined,//创建时间
                creation_finish_site:undefined,
                published_state:0,
                published_first_time:undefined,//发表时间
                published_country:undefined,
                published_city:undefined,//发表城市
                project_explain:undefined,//作品简介
                possess_power:[],
                trading_power:[],
                permission_type:undefined,//permission_type
                permission_start_time:undefined,//许可开始时间
                permission_end_time:undefined,// 许可期限结束时间
                permission_region:undefined,//许可区域
                possess_power_check_all:undefined,
                trading_power_check_all:undefined,
            },
            //作品
            works_table_form:{
                works_name:undefined,
                works_type:[],
                works_theme:undefined,
                works_region:undefined,
                author:undefined,
                creation_type:undefined,
                creation_remark:undefined,
                end_time:undefined,
                issue_region:undefined,
                authors:undefined,
                trading_power:[],
                works_explain:undefined,
                appenddix_type:undefined,
                appenddix_theme:undefined,
                appenddix_region:undefined
            },
            checkAll: false,
            checkAlls:false,
            checkAllss:false,
            isIndeterminate: true,
            isIndeterminates: true,
            isIndeterminatess: true,
            cover_image:undefined,//作品封面图
            uploadUrls: baseUrl+'api/file/imageUpload',//上传图片路径
            delist_image:[],//摘牌要求图片
            basic_image:[],//作品样图
            prove_image:[],//证明样图
            author_certificate:[],//著作权图
            prove_type:undefined,//证明类型【0：个人，1：企业】
            trading_type:undefined,//挂牌类型【0:作品挂牌，1：项目挂牌】
            term_type:undefined,
            price:undefined,//价格
            term:undefined, //天数
            startendTime:undefined,
            delist_text:undefined,
        }
    },
    created(){
      _self = this;
       _self.getDicts("works_type").then(res=>{ //作品类型字典
       console.log(res);
         _self.projectType=res.data;
       });
       _self.getDicts("creation_type").then(res=>{ //创作性质字典

            _self.creationType=res.data;
      });
      _self.getDicts("power_type").then(res=>{  //权利类型
      console.log(res);
            _self.powerType=res.data;
          })
      _self.getDicts("certificate_type").then(res=>{ //证件类型

            _self.certificateType=res.data;
          })
        _self.getDicts("works_theme").then(res=>{
            _self.worksTheme = res.data;
        })
        _self.getDicts("works_region").then(res=>{
             _self.worksRegion = res.data;
        })
    },
    methods:{
         handleCheckAllChange(val) {
            console.log(val);
            _self.powerType.forEach(item=>{  //当全选被选中的时候，循环遍历源数据，把数据的每一项加入到默认选中的数组去
            _self.project_table_form.possess_power.push(item.dictCode)
            })
            if(val==true){
                _self.project_table_form.possess_power_check_all=1
            }else{
                _self.project_table_form.possess_power_check_all=0
            }

            _self.project_table_form.possess_power = val ? _self.project_table_form.possess_power : [];
           _self.isIndeterminate = false;

      },
      handleCheckedCitiesChange(value) {

        let checkedCount = value.length;

        if(_self.powerType.length==checkedCount){
            _self.project_table_form.possess_power_check_all=1
        }else{
           _self.project_table_form.possess_power_check_all=0
        }
        _self.checkAll = checkedCount === _self.powerType.length;
        _self.isIndeterminate = checkedCount > 0 && checkedCount < _self.powerType.length;

      },
       handleCheckAllChanges(val) {

           if(val==true){
                _self.project_table_form.trading_power_check_all=1
            }else{
                _self.project_table_form.trading_power_check_all=0
            }
           _self.powerType.forEach(item=>{  //当全选被选中的时候，循环遍历源数据，把数据的每一项加入到默认选中的数组去
           _self.project_table_form.trading_power.push(item.dictCode)
           })
         _self.project_table_form.trading_power = val ? _self.project_table_form.trading_power : [];
        _self.isIndeterminates = false;

      },
      handleCheckedCitiesChanges(value) {
        console.log(value);
        let checkedCount = value.length;
        if(_self.powerType.length==checkedCount){
            _self.project_table_form.trading_power_check_all=1
        }else{
           _self.project_table_form.trading_power_check_all=0
        }
        _self.checkAlls = checkedCount === _self.powerType.length;
        _self.isIndeterminates = checkedCount > 0 && checkedCount < _self.powerType.length;

      },

    tradingPowerCheckAllChange(val) {


           _self.powerType.forEach(item=>{  //当全选被选中的时候，循环遍历源数据，把数据的每一项加入到默认选中的数组去
           _self.works_table_form.trading_power.push(item.dictCode)
           })
         _self.works_table_form.trading_power = val ? _self.works_table_form.trading_power : [];
        _self.isIndeterminatess = false;

      },
      tradingPowerCheckedChange(value) {
        console.log(value);
        let checkedCount = value.length;
        _self.checkAllss = checkedCount === _self.powerType.length;
        _self.isIndeterminatess = checkedCount > 0 && checkedCount < _self.powerType.length;

      },


      showContent(){
          if(_self.show==false){
              _self.show=true
          }else{
              _self.show=false;
          }
      },
      UploadImgSuccess:function(res){
           if(res.code==200){
               _self.cover_image = res.url;
              }
      },
       //图片上传组件
            handleRemove(file, fileList) {//移除
               // console.log(file, fileList);
            },
            handlePictureCardPreview(file) {//预览
               // console.log(file)
                this.image = file.url;
                this.dialogImg = true;
            },
            handleError(err){//上传失败
               // console.log(err)
            },
            beforeAvatarUpload(file) {//文件上传之前调用做一些拦截限制
                //console.log(file);
                const isJPG = true;
                const isLt2M = file.size / 1024 / 1024 < 2;
                if (!isLt2M) {
                    this.$message.error('上传图片大小不能超过 2MB!');
                }
                return isJPG && isLt2M;
            },
            handledelistImage(res){
                let files = res.url;
                _self.delist_image.push(files);
            },
            handlebasicImage(res){

                let files = res.url;
                _self.basic_image.push(files);
                //console.log(_self.basic_image);
            },
            handleproveImage(res){
                let files = res.url;
                console.log(res.url);
                _self.prove_image.push(files);
                console.log(_self.prove_image);
            },
            handleauthorCertificate(res){
                let files = res.url;
                _self.author_certificate.push(files);
            },
            changeTradingType(){
              this.term_type=undefined;
            },

            submitTrading(type){

                if(_self.trading_type==undefined){ this.$message.error('选择挂牌类型');return false}
                console.log(_self.trading_type);
                //type 代表是存草稿还是提交
                if(_self.trading_type==1){
                    _self.addTradingOne(type);
                }

                if(_self.trading_type==0){
                    _self.addTradingTwo(type);
                }




            },
            addTradingOne(type){

                if(_self.term_type==undefined){this.$message.error('选择项目类型');return false}
                if(_self.prove_type==undefined){ this.$message.error('选择身份');return false}
                if(_self.project_table_form.project_name==undefined){this.$message.error('请选进行标的信息登记');return false}
                if(!_self.cover_image){ this.$message.error('请上传项目缩略图');return false}
                if(_self.price==undefined){this.$message.error('请输入价格(面议传0)');return false}
                if(_self.term==undefined){this.$message.error('请输入约定的挂牌期限(天)');return false}
                if(_self.delist_text==undefined){this.$message.error('请输入对摘牌准入要求与条件');return false}
                if(_self.delist_image==undefined){this.$message.error('请上传摘牌要求图片');return false}
                if(_self.prove_image.length<=0){this.$message.error('请上传证明图片');return false}
                if(_self.basic_image.length<=0){this.$message.error('请上传挂牌作品样片');return false}
                if(_self.author_certificate.length<=0){this.$message.error('请上传著作权证书图');return false}
                //提交数据了
                //将数组转成字符串如果报错又要将数组转回去
                let prove_image_list =  _self.prove_image.join(",");
                let basic_image_list = _self.basic_image.join(",");
                let author_certificate_list = _self.author_certificate.join(",");
                let delist_image_list = _self.delist_image.join(',');
                let possess_power_list = _self.project_table_form.possess_power.join(",");
                let trading_power_list = _self.project_table_form.trading_power.join(",");

                _self.project_table_form.possess_power = possess_power_list;
                _self.project_table_form.trading_power = trading_power_list;
                let param = {
                  "trading_type":_self.trading_type,
                  "term_type":_self.term_type,
                  "prove_type":_self.prove_type,
                  "cover_image":_self.cover_image,
                  "price":_self.price,
                  "term":_self.term,
                  "prove_image":prove_image_list,
                  "basic_image":basic_image_list,
                  "author_certificate":author_certificate_list,
                  "delist_text":_self.delist_text,
                  "delist_image":delist_image_list,
                  "saveType":type,
                  "project_table":_self.project_table_form,
                  }

                  console.log(param);
                 // return 
                  addTrading(param).then((res)=>{
                    
                     if(res.code==200){
                      _self.$message.success("提交成功，等待审核");
                      _self.$router.push('myTrading');

                     }else{
                         _self.msgEorror(res.msg);


                     }
                     //这里应该还要处理转换过后的问题
                  })

            },
            addTradingTwo(type){
                // if(_self.term_type==undefined){this.$message.error('选择项目类型');return false}
                if(_self.prove_type==undefined){ this.$message.error('选择身份');return false}
                if(_self.works_table_form.works_name==undefined){this.$message.error('请选进行作品的信息登记');return false}
                if(!_self.cover_image){ this.$message.error('请上传项目缩略图');return false}
                if(_self.price==undefined){this.$message.error('请输入价格(面议传0)');return false}
                if(_self.term==undefined){this.$message.error('请输入约定的挂牌期限(天)');return false}
                if(_self.delist_text==undefined){this.$message.error('请输入对摘牌准入要求与条件');return false}
                if(_self.delist_image==undefined){this.$message.error('请上传摘牌要求图片');return false}
                if(_self.prove_image.length<=0){this.$message.error('请上传证明图片');return false}
                if(_self.basic_image.length<=0){this.$message.error('请上传挂牌作品样片');return false}
                if(_self.author_certificate.length<=0){this.$message.error('请上传著作权证书图');return false}
                let prove_image_list =  _self.prove_image.join(",");
                let basic_image_list = _self.basic_image.join(",");
                let author_certificate_list = _self.author_certificate.join(",");
                let delist_image_list = _self.delist_image.join(',');
                let trading_power_list = _self.works_table_form.trading_power.join(",");

                let param = {
                  "trading_type":_self.trading_type,
                  "term_type":_self.term_type,
                  "prove_type":_self.prove_type,
                  "cover_image":_self.cover_image,
                  "price":_self.price,
                  //"term":_self.term,
                  "prove_image":prove_image_list,
                  "basic_image":basic_image_list,
                  "author_certificate":author_certificate_list,
                  "delist_text":_self.delist_text,
                  "delist_image":delist_image_list,
                  "saveType":type,
                  "works_table":_self.works_table_form,
                  }
                  param.works_table.trading_power = trading_power_list;
                  console.log(param);
                  addTrading(param).then((res)=>{
                     if(res.code==200){
                      _self.$message.success("提交成功，等待审核");
                      _self.$router.push('myTrading');

                     }else{
                         _self.msgEorror(res.msg);


                     }
                     //这里应该还要处理转换过后的问题
                  })

            },
            checkProjectForm(){

                //登记表的验证
              if(_self.project_table_form.project_name==undefined){ this.$message.error('请输入作品名称');return false}
              if(_self.project_table_form.project_type==undefined){ this.$message.error('请选择作品类别');return false}
              if(_self.author_list[0].author_name==undefined){ this.$message.error('请输入著作权人的姓名或名称');return false}
              if(_self.author_list[0].certificate_type==undefined){ this.$message.error('请选择著作权人的证件类型');return false}
              if(_self.author_list[0].certificate_number==undefined){ this.$message.error('请输入著作权人的证件号码');return false}
              if(_self.author_list[0].country==undefined){ this.$message.error('请输入著作权人的国家');return false}
              if(_self.author_list[0].province==undefined){ this.$message.error('请输入著作权人的省份');return false}
              if(_self.author_list[0].city==undefined){ this.$message.error('请输入著作权人的城市');return false}
              //这里直接将输入的值丢给project_table_form
              //let testauthorlist=[];
             _self.author_list.forEach((item,index)=>{
                 console.log(item);
                 if(item.author_name!=undefined){
                     _self.project_table_form.project_author_list.push(item);
                     //testauthorlist.push(item);
                 }
             })

              if(_self.project_table_form.creation_type==undefined){ this.$message.error('请选择作品创作性质');return false}
              if(_self.project_table_form.creation_finish_time==undefined){ this.$message.error('请选择创作完成日期');return false}
              if(_self.project_table_form.creation_finish_site==undefined){ this.$message.error('请选择创作完成地点');return false}
              if(_self.project_table_form.published_state==1){
              if(_self.project_table_form.published_country==undefined){ this.$message.error('请输入发表国家');return false}
              if(_self.project_table_form.published_city==undefined){ this.$message.error('请输入发表城市');return false}
              }
              if(_self.project_table_form.project_explain==undefined){ this.$message.error('请输入作品简介');return false}
              if(_self.project_table_form.possess_power.length<=0){ this.$message.error('请选择著作权人权利拥有状况');return false}
              if(_self.project_table_form.trading_power.length<=0){ this.$message.error('请选择挂牌标的（挂牌出售的权利）');return false}
              if(_self.term_type==1){
                  if(_self.project_table_form.permission_type==undefined){ this.$message.error('请选择许可类型');return false}
                  if(_self.startendTime==undefined){ this.$message.error('请选择许可期限');return false}
                  _self.project_table_form.permission_start_time=_self.startendTime[0];//在这里直接给值了
                  _self.project_table_form.permission_end_time = _self.startendTime[1];//在这里直接给值了
                  if(_self.project_table_form.permission_region==undefined){ this.$message.error('请输入许可区域');return false}
              }
              _self.dialogVisible=false;
            },
            checkWokerForm(){
                  if(_self.works_table_form.works_name==undefined){ this.$message.error('请输入作品名称');return false}
                  if(_self.works_table_form.works_type==undefined){ this.$message.error('请选择作品类别');return false}
                  if(_self.works_table_form.works_theme==undefined){ this.$message.error('请选择作品题材');return false}
                  if(_self.works_table_form.works_region==undefined){ this.$message.error('请选择作品地区');return false}
                  if(_self.works_table_form.author==undefined){ this.$message.error('请输入作品著作权人');return false}
                  if(_self.works_table_form.creation_type==undefined){ this.$message.error('请选择作品创作类型');return false}
                  if(_self.works_table_form.creation_remark==undefined){ this.$message.error('请输入作品备注');return false}
                  if(_self.works_table_form.end_time==undefined){ this.$message.error('请输入创作完成时间');return false}
                  if(_self.works_table_form.issue_region==undefined){ this.$message.error('请输入发行地区');return false}
                  if(_self.works_table_form.authors==undefined){ this.$message.error('请输入主要创作人');return false}
                   if(_self.works_table_form.trading_power.length<=0){ this.$message.error('请选择作品权益类型');return false}
                   if(_self.works_table_form.works_explain==undefined){ this.$message.error('请作品简介');return false}
                 _self.dialogVisibles=false;
            }
    },


}
</script>
<style>

  @import "../../layui/css/layui.css";
    @import "../../css/index.css";
    @import "../../css/user_listing.css";
    @import "../../css/user_addlistingl.css";
    @import "../../css/idangerous.swiper.css";

.p-34{
    overflow: auto;
    max-height: 600px;
    margin-top: 0;
}
.ctype .el-radio{
    width: 60px !important;
}
.ptype .el-radio{
    width: 100px;
    padding: 5px;
}
.ptype input[type=radio]{
    margin-right: 0;
}
 .el-radio__input.is-checked .el-radio__inner{

border-color: #e6242c;
    background: #e6242c;
}
 .el-radio__input.is-checked+.el-radio__label{
    color: #e6242c;
}
.el-checkbox__label{
    width: 100px;
    padding: 5px;
}
.el-checkbox__input.is-checked+.el-checkbox__label{
     color: #e6242c;
}
.el-checkbox__input.is-checked .el-checkbox__inner, .el-checkbox__input.is-indeterminate .el-checkbox__inner{

border-color: #e6242c;
    background: #e6242c;
}
.p-7 .el-upload:hover {
    border-color: #409EFF;
  }
  .avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 215px;
    height: 150px;
    line-height: 150px;
    text-align: center;
  }
  .avatar {
    width: 215px;
    height: 150px;
    display: block;
  }
  .el-input__inner{
      border: 0;
  }
  .p-6{
      height: 310px;
  }
</style>
